#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
    float a = 0;
    int b = 0, c = 0, d = 0;
    scanf("%f %d %d %d", &a, &b, &c, &d);
    if (b == 11 && c == 11) {
        a = (a * 0.7) - (50 * d);
    }
    else if (b == 12 && c == 12) {
        a = (a * 0.8) - (50 * d);
    }
    if (a < 0) {
        printf("0.00\n");
    }
    else
        printf("%.2f", a);
    return 0;
}